package com.sxm.yiwei.pinche.view_interface;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.sxm.yiwei.R;
import com.sxm.yiwei.adapters.pinche.HostOrdersAdapter;
import com.sxm.yiwei.beans.pinche.HostOrder;
import com.sxm.yiwei.constant.Constant;

import java.util.ArrayList;

/**
 * A simple {@link Fragment} subclass.
 */
public class HostOrdersFragment extends Fragment {
    private static HostOrdersFragment mFragment;
    private ListView listView;
    private ArrayList<HostOrder> beanList;
    private int order_type;
    private String fragment_id;

    public HostOrdersFragment() {
        // Required empty public constructor
    }
    public static HostOrdersFragment newInstance(Bundle bundle){
        if (mFragment!=null){

        }else {
            mFragment=new HostOrdersFragment();
            mFragment.setArguments(bundle);
        }

        return mFragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Bundle bundle = getArguments();
        order_type = bundle.getInt("order_type");//0长途1同城2旅游3长途急件
        fragment_id = bundle.getString("fragment_id");//“大巴”或者“私家车”
        beanList=new ArrayList<>();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_host_orders, container, false);
        listView = (ListView)view.findViewById(R.id.listView);
        HostOrdersAdapter adapter = new HostOrdersAdapter(getActivity(),beanList, 0);
        listView.setAdapter(adapter);
        return view;
    }

}
